package cn.wolfcode.trip.base.domain;


import com.alibaba.druid.support.json.JSONUtils;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.HashMap;
import java.util.Map;

/**
 * 酒店的信息表
 */
@Getter
@Setter
@ToString
public class Hotel {

    private Long id;
    //名字
    private String name;
    //价格
    private Long price;
    //封面
    private String coverUrl;
    //地址
    private Region region;
    //酒店的类型
    private Integer hotelType;
    //简介
    private String comment;
    //地址
    private String address;
    //状态,推荐,普通,限时
    private Integer state;
    //序号
    private Integer sequence;

    public String getHotelTypeName() {
        if (hotelType == 1) {
            return "情侣酒店";
        } else if (hotelType == 2) {
            return "平价酒店";
        } else if (hotelType == 3) {
            return "快捷商务酒店";
        } else if (hotelType == 4) {
            return "高档星级酒店";
        }
        return "";
    }

    public String getStateDisplay() {
        if (state == 1) {
            return "普通";
        } else if (state == 2) {
            return "推荐";
        } else if (state == 3) {
            return "限时";
        }
        return "";
    }

    public String getRegionName() {
        if (region != null) {
            return region.getName();
        }
        return "";
    }


    public String getJson() {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("id", id);
        map.put("name", name);
        map.put("price", price);
        map.put("coverUrl", coverUrl);
        map.put("regionName", getRegionName());
        map.put("regionId", region.getId());
        map.put("hotelType", hotelType);
        map.put("comment", comment);
        map.put("address", address);
        map.put("state", state);
        map.put("sequence", sequence);
        map.put("hotelTypeName", getHotelType());
        return JSONUtils.toJSONString(map);

    }


}